package com.tedu.bill.demo2;

/**
 * Author：毕龙
 * Date: 2024/4/21 10:47
 */
public class TestStatic {
    public static void main(String[] args) {
        //使用静态的成员变量 直接使用类名.静态属性
        Student.a = 100;
        System.out.println(Student.a);
        Student stu = new Student();
        System.out.println(stu.a);//100
        stu.a = 200;
        System.out.println(Student.a);//200
        System.out.println(stu.a);//200
        //System.out.println(Student.b);

        //调用静态方法
        Student.m1();
        //Non-static method 'm2()' cannot be referenced from a static context
        m2();
    }

    public static void m2(){
        System.out.println("静态的m2方法");
    }
}

















